library shruken;
import 'dart:html';
import '../lib/game.dart';

class ShrukenDriver extends Driver {
  num x = 5, y = 35;
  
  update() {
    x += 0.2;
    y += 0.1;
  }
  
  render(CanvasRenderingContext2D ctx) {
    ctx.fillStyle = 'black';
    ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
    ctx.fillStyle = 'white';
    ctx.fillRect(3, 3, ctx.canvas.width - 6, ctx.canvas.height - 6);
    var x_ = x.abs() % ctx.canvas.width;
    var y_ = y.abs() % ctx.canvas.height;
    ctx.font = '32pt monospace normal';
    ctx.fillStyle = 'yellow';
    ctx.strokeStyle = 'black';
    ctx.fillText('${clock.now()}', x_, y_);
    ctx.strokeText('${clock.now()}', x_, y_);
  }
}

main() {
  var game = new Game(query('#canvas'), new ShrukenDriver());
  game.run();
}